// BasicPageParams
import { BasicFetchResult } from '@/api/model/baseModel';

export interface MenuListItem {
  id: string;
  orderNo: string;
  createTime: string;
  status: number;
  icon: string;
  component: string;
  permission: string;
}

export type MenuListGetResultModel = BasicFetchResult<MenuListItem>;

// 角色相关
export type CreateRoleParams = {
  name?: string;
  code?: string;
  order_no?: Number;
  remark?: string;
  status?: number;
  menu_ids?: string;
  ceated_by?: string;
};

// 用户相关
export type UpdateRoleParams = {
  id?: Number;
  name?: string;
  code?: string;
  order_no?: Number;
  remark?: string;
  status?: number;
  menu_ids?: string;
};

export type CreateUserParams = {
  nickname?: string;
  username?: string;
  password?: Number;
  avatar?: string;
  email?: number;
  mobile?: string;
  remark?: string;
  status?: Number;
  role_id?: Number;
  dept_id?: Number;
};

export type UpdateUserParams = {
  nickname?: string;
  username?: string;
  password?: string;
  avatar?: string;
  email?: number;
  mobile?: string;
  remark?: string;
  status?: Number;
  role_id?: Number;
  dept_id?: Number;
};

export type UserParams = {
  userName?: string;
  status?: string;
  page?: Number;
  pageSize?: Number;
};

// 接口相关
export type UpdateInterfaceParams = {
  id?: Number;
  name?: string;
  url?: string;
  method?: string;
  avatar?: string;
  description?: string;
  class_id?: Number;
  perms_code?: string;
};

export type CreateInterfaceParams = {
  name?: string;
  url?: string;
  method?: string;
  avatar?: string;
  description?: string;
  class_id?: Number;
  perms_code?: string;
};

export type InterfaceParams = {
  name?: string;
  url?: string;
  page?: Number;
  pageSize?: Number;
};

// 角色绑定接口相关
export type CreateRoleInterfaceParams = {
  role_id?: Number;
  interface_ids?: string;
};

export type CreateRoleButtonParams = {
  role_id?: Number;
  button_ids?: string;
};

export type UpdateButtonParams = {
  id?: Number;
  name?: string;
  code?: string;
  description?: number;
};

export type CreateButtonParams = {
  name?: string;
  code?: string;
  description?: number;
};

export type ButtonParams = {
  name?: string;
  code?: string;
  page?: Number;
  pageSize?: Number;
};

export interface CheckBoxOption {
  label: string;
  value: string;
  checked?: boolean;
}

export type ChangePasswordParams = {
  username?: string;
  passwordOld?: string;
  passwordNew?: string;
  passwordConfirm?: string;
};

export type ChangeStatusParams = {
  status?: Number;
};

// 菜单相关
export type MenuParams = {
  menuName?: string;
  status?: string;
};

export type CreateMenuParams = {
  parent_id?: Number;
  name?: string;
  title?: string;
  url?: string;
  perms?: string;
  type?: Number;
  icon?: string;
  order_no?: Number;
  status?: string;
  is_show?: Number;
  component?: string;
  path?: string;
  module_id?: Number;
  module_name?: string;
  affx?: Number;
  redirect?: Number;
};

export type UpdateMenuParams = CreateMenuParams & {
  id: Number;
};

// 部门相关
export interface DeptListItem {
  id?: string;
  orderNo?: string;
  createTime?: string;
  remark?: string;
  status?: number;
}

export type DeptListGetResultModel = BasicFetchResult<DeptListItem>;

/**
 * 数据字典相关的
 */
export type CreateDictionaryParams = {
  name?: string;
  type?: string;
  order_no?: Number;
  remark?: string;
};

export type UpdateDictionaryParams = CreateDictionaryParams;

export type PageParams = {
  page?: Number;
  pageSize?: Number;
};

export type DictionaryListParams = PageParams & {
  name?: string;
  code?: string;
  type?: string;
  parent_id?: Number;
  order_by?: string;
};

export interface DictionaryItem {
  id: string;
  parent_id: number;
  type: string;
  name: string;
  code: string;
  order_no: string;
  status: number;
  created_at: string;
  remark: string;
}

export type DictionaryListGetResultModel = BasicFetchResult<DictionaryItem>;

export type CreateDictionaryConfigParams = {
  name?: string;
  code?: string;
  order_no?: Number;
  remark?: string;
};

export type UpdateDictionaryConfigParams = CreateDictionaryConfigParams;
